<!-- 顶部开始 -->
<div class="container">
    <div class="logo"><a href="./index.html">后台管理系统</a></div>
    <div class="left_open">
        <i title="展开左侧栏" class="iconfont">&#xe699;</i>
    </div>
    <ul class="layui-nav right" lay-filter="">
        <li class="layui-nav-item">
            <a href="javascript:;">{:session('admin.nickname')}</a>
            <dl class="layui-nav-child"> <!-- 二级菜单 -->
                <dd><a href="#">个人信息</a></dd>
                <dd><a href="#" id="logout">退出</a></dd>
            </dl>
        </li>
    </ul>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="/tpblog/public/static/admin/lib/layui/layui.js" charset="utf-8"></script>
    <script>
        $(function () {
            $("#logout").click(function () {
                $.ajax({
                    url:"{:url('admin/home/logout')}",
                    type:'post',
                    dataType:'json',
                    success:function (data) {
                        if(data.code==1){
                            layer.msg(data.msg,{
                                icon:6,
                                time:2000,
                            },function () {
                                location.href=data.url
                            })
                        }else{
                            layer.open({
                                title:'退出失败',
                                content:data.msg,
                                icon:5,
                                anim:6
                            })
                        }
                    }
                })
            });
        })
    </script>
</div>
<!-- 顶部结束 -->